package com.itheima.controller;

import com.itheima.pojo.Category;
import com.itheima.service.CategoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/category")
@RestController
@RequiredArgsConstructor
public class CategoryController {

    private final CategoryService categoryService;
    /**
     * 查询所有分类
     */
    @GetMapping
    public List<Category> list(){
        return categoryService.list();
    }
}
